<?php
require './include/global.php';
require './include/validate.php';
require './include/all_left.php';
require_once './include/advisory_db.php';
//print_r($_SESSION);
$order = " ORDER BY a.re_id DESC ";
if($_GET[tp]==2){
	$by    = "a.jo_id"; 
	$order = "DESC" ;

	$_GET[order1]==''&&$order1=1;$_GET[order2]==''&&$order2=1;$_GET[order3]==''&&$order3=1;$_GET[order4]==''&&$order4=1;
	$_GET[order5]==''&&$order5=1;$_GET[order6]==''&&$order6=1;$_GET[order7]==''&&$order7=1;
	switch($_GET[swh]){
	   case 1:
		   $by = "a.jo_id";
		   if($_GET[order1]==1){$order_arr[1]=2; $order=" DESC ";$image_arr[1] = "<img src=\"images/dot1.gif\" align=\"absmiddle\">";}else{$order_arr[1]=1;$order=" ASC ";$image_arr[1] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   case 2:
		   $by = "b.app_regtime";
		   if($_GET[order2]==1){$order_arr[2]=2; $order=" DESC ";$image_arr[2] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[2]=1;$order=" ASC ";$image_arr[2] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   case 3:
			$by = "a.jo_title";
		   if($_GET[order3]==1){$order_arr[3]=2; $order=" DESC ";$image_arr[3] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[3]=1;$order=" ASC ";$image_arr[3] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   case 4:
		   $by = "a.jo_copname";
		   if($_GET[order4]==1){$order_arr[4]=2; $order=" DESC ";$image_arr[4] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[4]=1;$order=" ASC ";$image_arr[4] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
		case 5:
		   $by = "a.jo_status";
		   if($_GET[order5]==1){$order_arr[5]=2; $order=" DESC ";$image_arr[5] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[5]=1;$order=" ASC ";$image_arr[5] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   case 6:
		   $by = "a.jo_salrange";
		   if($_GET[order6]==1){$order_arr[6]=2; $order=" DESC ";$image_arr[6] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[6]=1;$order=" ASC ";$image_arr[6] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   case 7:
		   $by = "count";
		   if($_GET[order7]==1){$order_arr[7]=2; $order=" DESC ";$image_arr[7] = "<img src=\"images/dot1.gif\"  align=\"absmiddle\">";}else{$order_arr[7]=1;$order=" ASC ";$image_arr[7] = "<img src=\"images/dot2.gif\"  align=\"absmiddle\">";}
		   break;
	   }
		$smarty->assign("order_arr2",$order_arr);
		$smarty->assign("image_arr2",$image_arr);
		$order = "GROUP BY jo_id  ORDER BY $by $order";

}
if($_GET[action] == "search"){
	$where  = " AND b.jo_title like '%".$_GET[keywords]."%'";
	$smarty->assign("keywords",$_GET[keywords]);
}

$list = $DB->fetch_all("SELECT a.*,b.* FROM pa_resume as a , pa_job as b WHERE a.re_aliasid = b.jo_id AND re_uid = '".$_SESSION[uid]."' $where $order");
if(!empty($list)){
	foreach($list as $k => $v){
		$list[$k][jo_salrange]   = $salary[$v[jo_salrange]];
		$list[$k][jo_status]     = $jobfillstatus[$v[jo_status]];
	}
}
$smarty->assign("joblist2",$list);

$smarty->display('header.tpl');
$smarty->display('allleft.tpl');
$smarty->display('employercontact.tpl');

$smarty->display('footer.tpl');

?>